//
//  IntroduceViewController.m
//  OCUI
//
//  Created by login on 15-7-20.
//
//

#import "IntroduceViewController.h"

@interface IntroduceViewController ()<UIScrollViewDelegate>
{
    UIScrollView *introduceScrollView;
}
@end

@implementation IntroduceViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.view.backgroundColor = [UIColor whiteColor];
    
    NSArray *imageArray = @[[UIImage imageNamed:@"introduce1.jpg"],[UIImage imageNamed:@"introduce2.jpg"],[UIImage imageNamed:@"introduce3.jpg"]];
    
    introduceScrollView = [[UIScrollView alloc]initWithFrame:self.view.frame];
    [introduceScrollView setPagingEnabled:YES];
    introduceScrollView.showsVerticalScrollIndicator = NO;
    introduceScrollView.showsHorizontalScrollIndicator = NO;
    introduceScrollView.delegate = self;
    introduceScrollView.contentSize = CGSizeMake(self.view.frame.size.width*imageArray.count, 0);
    introduceScrollView.bounces = YES;
    introduceScrollView.scrollEnabled = YES;
    [self.view addSubview:introduceScrollView];
    
    for (int i=0; i<imageArray.count; i++) {
        
        UIImageView *imageView = [[UIImageView alloc]initWithFrame:CGRectMake(self.view.frame.size.width*i, 0, self.view.frame.size.width, self.view.frame.size.height)];
        imageView.contentMode = UIViewContentModeScaleToFill;
        imageView.image = imageArray[i];
        [introduceScrollView addSubview:imageView];
        if (i == 2) {
            UIButton *button = [[UIButton alloc]initWithFrame:CGRectMake(self.view.frame.size.width*i, 200, 100, 50)];
            [button setBackgroundColor:[UIColor yellowColor]];
            [button addTarget:self action:@selector(enterMain) forControlEvents:UIControlEventTouchUpInside];
            [introduceScrollView addSubview:button];
        }

    }
    
}
- (void)enterMain
{
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
